#!/usr/bin/perl

if ($#ARGV != 0) {
	die "should provide the absolute library path as argument to this script";
}

$libpath=$ARGV[0];

$groupId="org.eclipse";
@jars=qw(org.eclipse.ui.workbench_3.7.1.v20120104-1859.jar org.eclipse.ui.forms_3.5.101.v20111011-1919.jar org.eclipse.text_3.5.101.v20110928-1504.jar org.eclipse.swt.win32.win32.x86_64_3.7.2.v3740f.jar org.eclipse.osgi_3.7.2.v20120110-1415.jar org.eclipse.jface.text_3.7.2.v20111213-1208.jar org.eclipse.jface_3.7.0.v20110928-1505.jar org.eclipse.equinox.registry_3.5.101.R37x_v20110810-1611.jar org.eclipse.equinox.common_3.6.0.v20110523.jar org.eclipse.core.commands_3.6.0.I20110111-0800.jar org.eclipse.core.runtime_3.7.0.v20110110.jar swt-3.7.2-win32-win32-x86_64.jar swt-3.7.2-win32-win32-x86.jar swt-3.7.2-gtk-linux-x86_64.jar swt-3.7.2-gtk-linux-x86.jar swt-3.7.2-cocoa-macosx-x86_64.jar swt-3.7.2-cocoa-macosx-x86.jar);


#do not edit below this line
foreach $jar(@jars) {
	$artifactId = $jar; 
	$artifactId =~ s/_/-/g;
	$artifactId =~ s/(.*)([-]([0-9]+\.)+)(.*)/$1/g;
	
	$version = $jar;
	$version =~ s/(.*)([-]([0-9]+\.)+)(.*)/$2/g;
	#replace starting - with ""
	$version =~ s/^-//g;
	#replace ending . with ""
	$version =~ s/\.$//g;
	print "Will install ($groupId,$artifactId,$version,$libpath/$jar)\n";

	#system("mvn install:install-file -DgroupId=$groupId -DartifactId=$artifactId -Dversion=$version -Dfile=\"$libpath/$jar\" -Dpackaging=jar -DgeneratePom=true");
}
